objects=layout.o resource.o action_msg.o schedule_test.o common.o sock_msg_ctl.o gp_task.o

objects += gp_dp1_ctl.o gp_dp8_ctl.o gp_subboard_ctl.o gp_dj_ctl.o gp_qpcr_ctl.o


objects += gp_openlid_ctl.o gp_seal_ctl.o gp_logistic_ctl.o hash_test.o

MAKE_GP1=0

CFLAGS=-I/home/hcgy/extend_disk/libjson/jsoncpp/include/ 
CFLAGS+= -I../../app/

ifeq ($(MAKE_GP1),1)
CFLAGS+= -D_GP_1
install_path=hcsci@10.3.1.198:/home/yuantao/files/gp_beta
else
install_path=hcsci@10.3.1.176:/home/yuantao/files/gp_beta
endif

LDFLAGS=-lpthread -Wl,-rpath=/mnt/nandflash/apps/libs -L/home/hcgy/extend_disk/libjson/libjsoncpp_x64/libs/linux-gcc-5.4.0
LDFLAGS+= -L/home/hcgy/extend_disk/libjson/jsoncpp/build/debug/src/lib_json/ -ljsoncpp

CFLAGS += -I/home/hcgy/extend_disk/libxml2/libxml2-2.9.10/install_arm/include/libxml2/
LDFLAGS+= -L/home/hcgy/extend_disk/libxml2/libxml2-2.9.10/install_arm/lib/ -lxml2

layout.o:./gp_layout_map.cpp ./gp_layout_map.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

resource.o:./resource_manage.cpp ./gp_layout_map.h ./resource_manage.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

action_msg.o:../lua/action_msg.cpp ../lua/action_msg.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

sock_msg_ctl.o:sock_msg_ctl.cpp sock_msg_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

schedule_test.o:schedule_test.cpp ./gp_layout_map.h ./resource_manage.h ./sock_msg_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

common.o:../../app/common.cpp ../../app/common.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_dp1_ctl.o:gp_dp1_ctl.cpp gp_dp1_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_dp8_ctl.o:gp_dp8_ctl.cpp gp_dp8_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_subboard_ctl.o:gp_subboard_ctl.cpp gp_subboard_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_dj_ctl.o:gp_dj_ctl.cpp gp_dj_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_qpcr_ctl.o:gp_qpcr_ctl.cpp gp_qpcr_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_openlid_ctl.o:gp_openlid_ctl.cpp gp_openlid_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_seal_ctl.o:gp_seal_ctl.cpp gp_seal_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_logistic_ctl.o:gp_logistic_ctl.cpp gp_logistic_ctl.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

gp_task.o:gp_task.cpp gp_task.h
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

hash_test.o:../lua/hash_test.cpp 
	$(CXX) -g -c -o $@ $< $(CFLAGS) $(LDFLAGS)

schedule_arm:$(objects)
	$(CXX) -g -o $@ $^ $(LDFLAGS)
#	scp $@ root@10.3.0.205:/mnt/nandflash/grpc/bin/$@
	scp $@ $(install_path)/$@

.PHONY:clean
clean:
	rm $(objects) schedule_arm